package com.ywxx.dyhelper.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;

import com.ywxx.dyhelper.R;
import com.ywxx.dyhelper.base.BaseAcitivity;
import com.ywxx.dyhelper.model.TaskConfig;
import com.ywxx.dyhelper.utils.ConstValues;
import com.ywxx.dyhelper.widget.NumberAddSubView;

/**
 * 一键已读
 */
public class ReadMessageActivity extends BaseAcitivity
{

    private NumberAddSubView labOperNum;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_read_message);

        InitUI();
        DataToUI();
    }

    @Override
    protected void InitUI()
    {
        InitTitle();
        labOperNum = findViewById(R.id.labOperNum);
        labOperNum.setValue(1000);
        labOperNum.setMaxValue(60000);
        labOperNum.setSeekNum(500);

        llStart.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                appconfig = new TaskConfig();

                appconfig.oprtime = labOperNum.getValue();
                ConstValues.SaveValue(ReadMessageActivity.this, "opertime" + TaskType, appconfig.oprtime);

                StartTaskServer(TaskType);
            }
        });
    }

    @Override
    protected void DataToUI()
    {
        int opertime = ConstValues.getIntValue(this, "opertime" + TaskType, 1000);
        labOperNum.setValue(opertime);
    }
}